<template>
	<view>
		<view class="carItem">
			<image class="carImage" :src="carInfo.modelUrl|mmvImageUrl" mode=""></image>
			<view class="carContent">
				<text class="carInfo">{{carInfo.modelName}}</text>
				<view class="priceBox">
					<text v-if="bizType == '2'" class="nowPrice1" :class="[
						viewType == 1 ? 'nowPrice101' : '',
						viewType == 2 ? 'nowPrice102' : ''
					]">{{carInfo.modelPresentPrice}}</text>
					<text v-else class="nowPrice2" :class="[
						viewType == 1 ? 'nowPrice201' : '',
						viewType == 2 ? 'nowPrice202' : ''
					]">{{carInfo.modelPresentPrice}}</text>
					<text class="price">¥{{carInfo.modelOriginalPrice}}/{{bizType == '2' ? '月' : '天'}}</text>
				</view>
				<view class="bottomView">
					<text class="number">剩余{{carInfo.releaseNumber}}</text>
					<view class="btn" :class="[
						viewType == 1 ? 'btn1' : '',
						viewType == 2 ? 'btn2' : ''
					]" @click="configOrder">
						立即订车
					</view>
				</view>
			</view>

		</view>
	</view>
</template>

<script>
	export default {
		name: '',
		data() {
			return {

			}
		},
		props: {
			carInfo: {
				type: Object,
				default () {
					return {}
				}
			},
			bizType: {
				type: Number | String,
				default: 1
			},
			viewType: {
				type: Number | String,
				default: 1
			}
		},
		mounted() {

		},
		methods: {
			configOrder() {
				this.$emit('configOrder', this.carInfo);
			}
		}

	}
</script>

<style lang="scss" scoped>
	.carItem {
		margin-bottom: 18rpx;
		width: 321rpx;
		height: 371rpx;
		background: #ffffff;
		border: 1rpx solid #dcdcdc;
		border-radius: 16rpx;
		display: flex;
		flex-direction: column;
		align-items: center;

		.carImage {
			width: 260rpx;
			height: 150rpx;
		}

		.carContent {
			display: flex;
			flex-direction: column;
			justify-content: flex-start;
			width: 80%;

			.carInfo {
				margin-top: 20rpx;
				font-size: 28rpx;
				font-weight: bold;
				color: #131313;
				display: -webkit-box;
				overflow: hidden;
				text-overflow: ellipsis;
				word-wrap: break-word;
				white-space: normal !important;
				-webkit-line-clamp: 2;
				-webkit-box-orient: vertical;
			}

			.priceBox {
				display: flex;
				justify-content: space-between;
				align-items: center;

				.nowPrice2 {
					font-size: 36rpx;
					font-weight: bold;
					text-align: left;
					color: #ff781f;
                    &.nowPrice201 {
                    	color: #ff781f;
                    }
                    &.nowPrice202 {
                    	color: #DF282E;
                    }
					&::before {
						content: '¥';
						font-size: 24rpx;
					}

					&::after {
						content: '/天';
						font-size: 24rpx;
					}

				}

				.nowPrice1 {
					font-size: 36rpx;
					font-weight: bold;
					text-align: left;
					color: #ff781f;
                    &.nowPrice101 {
						color: #ff781f;
					}
					&.nowPrice102 {
						color: #DF282E;
					}
					&::before {
						content: '¥';
						font-size: 24rpx;
					}

					&::after {
						content: '/月';
						font-size: 24rpx;
					}

				}

				.price {
					font-size: 24rpx;
					font-weight: bold;
					text-decoration: line-through;
					text-align: left;
					color: #aaaaaa;
					margin-left: 10rpx;
				}
			}

			.bottomView {
				display: flex;
				justify-content: space-between;
				align-items: center;
				margin-bottom: 10rpx;

				.number {
					font-size: 20rpx;
					font-weight: bold;
					color: #999999;
				}

				.btn {
					width: 180rpx;
					height: 56rpx;
					line-height: 56rpx;
					background: linear-gradient(to left, #ff500b 0%, #ff9829 99%);
					border-radius: 28rpx;
					color: #ffffff;
					font-size: 24rpx;
					font-weight: bold;
					text-align: center;
					&.btn1 {
						background: linear-gradient(to left, #ff500b 0%, #ff9829 99%);
					}
					&.btn2 {
						background: linear-gradient(to left, #f7654f 1%, #f42f36 100%);
					}
				}
			}

		}


	}
</style>
